﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OntologyFormDesigner.Viewer
{
    [OntologyFormDesigner.Annotation.Widget("AudioViewer")]
    public partial class AudioViewer : AxWMPLib.AxWindowsMediaPlayer, OntologyUtility.Interfaces.IWidgetViewer
    {
        public AudioViewer()
        {
            InitializeComponent();
        }

        String type;
        public string Type
        {
            get
            {
                try
                {
                    return type;
                }
                catch (Exception)
                {
                    return "";
                }
            }
            set
            {
                type = value;
            }
        }

        protected OntologyUtility.Xml.WidgetLocation location = null;
        public OntologyUtility.Xml.WidgetLocation WidgetLocation
        {
            get
            {
                return location == null ? new OntologyUtility.Xml.WidgetLocation(base.Location.X, base.Location.Y, this.Dock.ToString(), this.Anchor.ToString()) : location;
            }
            set
            {
                this.location = value;
                Console.WriteLine("THIS.LOCATION X: {0}, Y: {1}", location.X, location.Y);
                this.Left = location.X;
                this.Top = location.Y;
            }
        }

        String wParent = null;
        public String WidgetParent
        {
            get
            {
                try
                {
                    return wParent == null ? this.Parent.Name : wParent;
                }
                catch (Exception)
                {
                    return "";
                }
            }
            set
            {
                wParent = value;
            }
        }

        protected OntologyUtility.Xml.WidgetSize wSize = null;
        public OntologyUtility.Xml.WidgetSize WidgetSize
        {
            get
            {
                return wSize == null ? new OntologyUtility.Xml.WidgetSize(base.Width, base.Height) : wSize;
            }
            set
            {
                wSize = value;
                this.Size = new Size(wSize.Width, wSize.Height);
            }
        }
    }
}
